// npm install ts-node -g 
// npm init -y 生成package.json
// npm install @types/node -D   声明文件
// npm install express -S   node.js的一个简单的web开发框架
// npm install @types/express -D  声明文件 
// npm install axios -S  请求

import express, { Express, Router, Request, Response } from 'express'
import axios from 'axios'
const app: Express = express()
app.use('*', (req, res, next) => {
    res.header('Access-Control-Allow-Origin', '*')
    next()
})

const router: Router = express.Router() // 路由

app.use('/api', router)

router.get('/list', async (req: Request, res: Response) => {
    const result = await axios.post('https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf')
    res.json({
        ...result.data.data
    })
})

app.listen(3333, () => {
    console.log('success server http://localhost:3333')
})